﻿@using Fly.Domain.Models;
@using Fly.Domain.Infrastructure;
@model GetPagingResponse<Post>
@{
    ViewBag.Title = "主页";
    Layout = "~/Views/Shared/_LayoutPage.cshtml";

}

<div class="main layui-clear">
    <div class="wrap">
        <div class="content">
            <div class="fly-tab">
                <span>
                    <a href="@Url.Action("Index", "Post")" class="tab-this">全部</a>
                    <a href="@Url.Action("Unsolved", "Post")">未结帖</a>
                    <a href="@Url.Action("Solved", "Post")">已采纳</a>
                    <a href="@Url.Action("Wonderful", "Post")">精帖</a>
                    @if (HttpContext.Current.User.Identity.IsAuthenticated)
                    {
                        <a href="@Url.Action("Index", "Account")">我的帖</a>
                    }
                </span>
                <form action="http://cn.bing.com/search" class="fly-search">
                    <i class="iconfont icon-sousuo"></i>
                    <input class="layui-input" autocomplete="off" placeholder="搜索内容，回车跳转" type="text" name="q">
                </form>
                <a href="@Url.Action("Add", "Post")" class="layui-btn jie-add">发布问题</a>
            </div>
            <ul class="fly-list">

                @if (Model.IsSuccess)
                {
                    foreach (var item in Model.Pages.Items)
                    {
                        <li class="fly-list-li">
                            <a href="@Url.Action("Home", "Account", new { userId = item.UserId })" class="fly-list-avatar">
                                <img src="@item.User.HeadPortrait" alt="">
                            </a>
                            <h2 class="fly-tip">
                                <a href="@Url.Action("Detail", "Post", new { postId = @item.Id })">@item.Title</a>
                                @if (item.IsTop)
                                {
                                    <span class="fly-tip-stick">置顶</span>
                                }
                                @if (item.IsBoutique)
                                {
                                    <span class="fly-tip-jing">精帖</span>
                                }
                            </h2>
                            <p>
                                <span><a href="@Url.Action("Home", "Account", new { userId = item.UserId })">@item.User.Nickname</a></span>
                                <span>@item.TimeAgo</span>
                                <span>@item.PostCategory.CategoryName</span>
                                <span class="fly-list-hint">
                                    <i class="iconfont" title="回答">&#xe60c;</i> @item.CommentCount
                                    <i class="iconfont" title="人气">&#xe60b;</i> @item.Hits
                                </span>
                            </p>
                        </li>
                    }
                }
            </ul>
            @if (Model.Pages.TotalItems > 30)
            {
                <div style="text-align: center">
                    <div class="laypage-main">
                        <a href="@Url.Action("Index", "Post")" class="laypage-next">更多求解</a>
                    </div>
                </div>
            }
        </div>
    </div>
    <div class="edge">
        <!--月度雷锋榜TOP12-->
        @{Html.RenderAction("LoadContributionTopTwelve");}
        <!--最近热帖 TOP8-->
        @{Html.RenderAction("LoadHotPostTopFifty");}
        <!--近期热议 TOP8-->
        @{Html.RenderAction("LoadHotCommentTopFifty");}
        <!--友情链接-->
        @{Html.RenderAction("LoadLinks");}
    </div>
</div>
